package com.xzz.listnode;

/**
 * @author: hhz
 * @create: 2021-12-22 16:36
 **/
public class MiddleNode {
    public static void main(String[] args) {

    }
    public  static  ListNode middleNode(ListNode head) {
        ListNode slow = head;
        ListNode fast = head;
        while(fast!=null && fast.next!=null){
            slow = slow.next;
            fast = fast.next.next;
        }
        return slow;
    }
}
